home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_weap_imp3.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  205 lines

  1. # Jones 3D Cog Script
  2. #
  3. # weap_IMP3.cog
  4. #
  5. # [RT]
  6. #
  7. # Controls Infernal Machine Part #3, the Levitator.
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ===================================================================
  12.  
  13. symbols
  14.  
  15. message        startup
  16. message        fire
  17. message        activated
  18. message        deactivated
  19. message        selected
  20. message        deselected
  21. message        callback
  22. message        pulse
  23. message        changed
  24.  
  25. model        impOn=imp3_levit_on.3do        local    # Autoloaded
  26. model        impOff=imp3_levit.3do        local    # Autoloaded
  27.  
  28. sound        pull=gen_grenade_pull.wav    local    # Autoloaded
  29. sound        put=gen_grenade_put.wav        local    # Autoloaded
  30. sound        pow=imp3_activate.wav        local    # Autoloaded
  31. sound        on=imp3_powerup.wav            local    # Autoloaded
  32. sound        off=imp3_powerdown.wav        local    # Autoloaded
  33. sound        loop=imp3_on_loop.wav        local    # Autoloaded
  34.  
  35. template    tplGlow=+imp3_glow            local    # Autoloaded
  36.  
  37. thing        player                        local
  38. thing        glow                        local
  39.  
  40. int            weaponNum=16                local
  41. int            handMesh                    local
  42. int            handNode                    local
  43. int            callNum                        local
  44. int            curSound                    local
  45. int            index                        local
  46.  
  47. int            bOn=0                        local
  48. int            bDisabled=0                    local
  49.  
  50. vector        dustPos                        local
  51.  
  52. end
  53.  
  54. # ===================================================================
  55.  
  56. code
  57.  
  58. startup:
  59.  
  60.     player = GetLocalPlayerThing();
  61.     handMesh = GetMeshByName(player, "inrhand");
  62.     handNode = GetNodeByName(player, "inrhand");
  63.  
  64.     return;
  65.  
  66. # -------------------------------------------------------------------
  67.  
  68. fire:
  69.  
  70.     if (bDisabled)
  71.     {
  72.         bDisabled = 0;
  73.         return;
  74.     }
  75.  
  76.     if (bOn)
  77.     {
  78.         SetThingMesh(player, handMesh, impOff, 0);
  79.         IMPEndFiring(16);
  80.         SetPulse(0);
  81.         bOn = 0;
  82.     }
  83.     else
  84.     {
  85.         SetThingMesh(player, handMesh, impOn, 0);
  86.         IMPStartFiring(16);
  87.  
  88.         PlaySoundThing(pow, player, 1, -1, -1, 0x880);
  89.         StartJewelFlying();
  90.  
  91.         SetPulse(0.1);
  92.         dustPos = GetThingJointPos(player, handNode);
  93.         dustPos = VectorAdd(dustPos, '0 0 0.025'); 
  94.         MakeFairyDust(player, dustPos);
  95.         bOn = 1;
  96.     }
  97.  
  98.     SetFireWait(player, 1.0);
  99.  
  100.     return;
  101.  
  102. # -------------------------------------------------------------------
  103.  
  104. activated:
  105.  
  106.     ActivateWeapon(player, 0.01);
  107.     return;
  108.  
  109. # -------------------------------------------------------------------
  110.  
  111. deactivated:
  112.  
  113.     DeactivateWeapon(player);
  114.     return;
  115.  
  116. # -------------------------------------------------------------------
  117.  
  118. selected:
  119.  
  120.     SetAimWait(player, 0.0);
  121.     SetMountWait(player, 0.7);
  122.  
  123.     SetArmedMode(player, 5);
  124.     SetCurWeapon(player, weaponNum);
  125.     SetThingFireOffset(player, '0.0 0.0 0.0'); 
  126.  
  127.     CaptureThing(player);
  128.     PlayMode(player, 66, 0);
  129.  
  130.     return;
  131.  
  132. # -------------------------------------------------------------------
  133.  
  134. deselected:
  135.  
  136.     if(bOn)
  137.     {
  138.         SetThingMesh(player, handMesh, impOff, 0);
  139.         IMPEndFiring(16);
  140.         SetPulse(0);
  141.         bOn = 0;
  142.     }
  143.  
  144.     SetMountWait(player, 1.0);
  145.     StopMode(player, 66, 0);
  146.  
  147.     CaptureThing(player);
  148.     PlayMode(player, 67, 0);
  149.  
  150.     SetArmedMode(player, 0);
  151.  
  152.     StopSound(curSound, 0.0);
  153.     PlaySoundThing(off, player, 1, -1, -1, 0x880);
  154.  
  155.     return;
  156.  
  157. # -------------------------------------------------------------------
  158.  
  159. callback:
  160.  
  161.     callNum = GetParam(1);
  162.     ReleaseThing(player);
  163.  
  164.     if (callNum == 28)
  165.     {
  166.         # Model swaps & FX
  167.         SetWeaponModel(player, weaponNum);
  168.         glow = AttachThingToThingMesh(player, tplGlow, handMesh);
  169.         
  170.         # Sounds
  171.         PlaySoundThing(pull, player, 1, -1, -1, 0x880);
  172.         PlaySoundThing(on, player, 1, -1, -1, 0x880);
  173.         Sleep(0.2);
  174.         curSound = PlaySoundThing(loop, player, 1, -1, -1, 0x881);
  175.     }
  176.     else if (callNum == 29)
  177.     {
  178.         # Cleanup...
  179.         ResetWeaponModel(player);
  180.         DetachThingMesh(glow);
  181.  
  182.         PlaySoundThing(put, player, 1, -1, -1, 0x880);
  183.     }
  184.  
  185.     return;
  186.  
  187. # -------------------------------------------------------------------
  188.  
  189. pulse:
  190.  
  191.     dustPos = GetThingJointPos(player, handNode);
  192.     dustPos = VectorAdd(dustPos, '0 0 0.025'); 
  193.     MakeFairyDust(player, dustPos);
  194.     return;
  195.  
  196. # -------------------------------------------------------------------
  197.  
  198. changed:
  199.  
  200.     # This message is called when an IMP is activated on an IMP stand
  201.     bDisabled = 1;
  202.     return;
  203.  
  204. end
  205.